package com.xbts.system.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.xbts.system.mapper.CnHuaweiAccountBindInfoMapper;
import com.xbts.system.domain.CnHuaweiAccountBindInfo;
import com.xbts.system.service.ICnHuaweiAccountBindInfoService;
import com.xbts.common.utils.DateUtils;
import com.xbts.common.utils.SecurityUtils;

/**
 * 华为云账号绑定信息Service业务层处理
 * 
 * @author xbts
 * @date 2023-12-06
 */
@Service
public class CnHuaweiAccountBindInfoServiceImpl  extends ServiceImpl<CnHuaweiAccountBindInfoMapper, CnHuaweiAccountBindInfo> implements ICnHuaweiAccountBindInfoService {

    /**
     * 查询华为云账号绑定信息列表
     *
     * @param cnHuaweiAccountBindInfo 华为云账号绑定信息
     * @return 华为云账号绑定信息
     */
    @Override
    public List<CnHuaweiAccountBindInfo> selectCnHuaweiAccountBindInfoList(CnHuaweiAccountBindInfo cnHuaweiAccountBindInfo) {
        QueryWrapper<CnHuaweiAccountBindInfo> queryWrapper = cnHuaweiAccountBindInfo.queryWrapper();
        return list(queryWrapper);
    }

    /**
     * 查询华为云账号绑定信息
     *
     * @param id 华为云账号绑定信息主键
     * @return 华为云账号绑定信息
     */
    @Override
    public CnHuaweiAccountBindInfo selectCnHuaweiAccountBindInfoById(String id) {
        return getById(id);
    }

    /**
     * 新增华为云账号绑定信息
     *
     * @param cnHuaweiAccountBindInfo 华为云账号绑定信息
     * @return 结果
     */
    @Override
    public boolean insertCnHuaweiAccountBindInfo(CnHuaweiAccountBindInfo cnHuaweiAccountBindInfo) {
        cnHuaweiAccountBindInfo.setCreateBy(SecurityUtils.getUserId().toString());
        return save(cnHuaweiAccountBindInfo);
    }

    /**
     * 修改华为云账号绑定信息
     *
     * @param cnHuaweiAccountBindInfo 华为云账号绑定信息
     * @return 结果
     */
    @Override
    public boolean updateCnHuaweiAccountBindInfo(CnHuaweiAccountBindInfo cnHuaweiAccountBindInfo) {
        cnHuaweiAccountBindInfo.setUpdateBy(SecurityUtils.getUserId().toString());
        cnHuaweiAccountBindInfo.setUpdateTime(DateUtils.getNowDate());
        return updateById(cnHuaweiAccountBindInfo);
    }

    /**
     * 批量删除华为云账号绑定信息
     *
     * @param ids 需要删除的华为云账号绑定信息主键
     * @return 结果
     */
    @Override
    public boolean deleteCnHuaweiAccountBindInfoByIds(List<String> ids) {
        return removeBatchByIds(ids);
    }

    /**
     * 删除华为云账号绑定信息信息
     *
     * @param id 华为云账号绑定信息主键
     * @return 结果
     */
    @Transactional
    @Override
    public boolean deleteCnHuaweiAccountBindInfoById(String id) {
      return removeById(id);
    }

}
